﻿// Gateway.Api 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
// 
// 本项目主要遵循 MIT 许可证和 Apache 许可证（版本 2.0）进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
// 
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动！任何基于本项目二次开发而产生的一切法律纠纷和责任，我们不承担任何责任！

using Aurora.AI.SqlSugar.Framework;
using Aurora.AI.Wiki.Domain.Domain.Wikis.Aggregates;
using SqlSugar;

namespace Aurora.AI.Wiki.Domain.DataAccess.Mapping;

/// <summary>
/// WikiDetail mapping
/// </summary>
public class WikiDetailMapping : IEntityMapping<WikiDetail>
{
    public void EntityServiceMapping(EntityColumnable<WikiDetail> entityColumnInfo)
    {
        entityColumnInfo
            .UpdateProperty(it => it.Id, it =>
            {
                it.IsPrimarykey = true;
                it.DataType = "varchar(50)";
                it.ColumnDescription = "主键标识";
            }).UpdateProperty(it => it.WikiId, it =>
            {
                it.DataType = "varchar(50)";
                it.ColumnDescription = "知识库Id";
                it.IsNullable = false;
            }).UpdateProperty(it => it.FileName, it =>
            {
                it.DataType = "varchar(100)";
                it.ColumnDescription = "文件名称";
                it.IsNullable = true;
            }).UpdateProperty(it => it.FileId, it =>
            {
                it.DataType = "varchar(50)";
                it.ColumnDescription = "文件Id";
                it.IsNullable = true;
            }).UpdateProperty(it => it.Path, it =>
            {
                it.DataType = "varchar(500)";
                it.ColumnDescription = "件路径 如果文件类型是链接，则为链接地址，否则为文件路径";
                it.IsNullable = true;
            }).UpdateProperty(it => it.DataCount, it =>
            {
                it.DataType = "int";
                it.ColumnDescription = "数据数量";
            }).UpdateProperty(it => it.Type, it =>
            {
                it.DataType = "varchar(10)";
                it.ColumnDescription = "知识库文件类型";
                it.IsNullable = true;
            }).UpdateProperty(it => it.State, it =>
            {
                it.DataType = "int";
                it.ColumnDescription = "知识库状态";
            }).UpdateProperty(it => it.MaxTokensPerParagraph, it =>
            {
                it.DataType = "int";
                it.ColumnDescription = "MaxTokensPerParagraph";
            }).UpdateProperty(it => it.MaxTokensPerLine, it =>
            {
                it.DataType = "int";
                it.ColumnDescription = "MaxTokensPerLine";
            }).UpdateProperty(it => it.OverlappingTokens, it =>
            {
                it.DataType = "int";
                it.ColumnDescription = "OverlappingTokens";
            }).UpdateProperty(it => it.Mode, it =>
            {
                it.DataType = "int";
                it.ColumnDescription = "模式 0 自动 1 自定义";
                it.DefaultValue = "0";
            }).UpdateProperty(it => it.TrainingPattern, it =>
            {
                it.DataType = "int";
                it.ColumnDescription = "文档切分方式 0 分段 1 问答";
                it.DefaultValue = "0";
            }).UpdateProperty(it => it.QAPromptTemplate, it =>
            {
                it.DataType = "text";
                it.ColumnDescription = "QAPrompt模板";
                it.IsNullable = true;
            })
            .UpdateProperty(it => it.Creator, it =>
            {
                it.DataType = "varchar(50)";
                it.ColumnDescription = "创建人";
                it.IsNullable = true;
            }).UpdateProperty(it => it.CreationTime, it =>
            {
                it.DataType = "datetime";
                it.ColumnDescription = "创建时间";
                it.IsNullable = true;
            }).UpdateProperty(it => it.Modifier, it =>
            {
                it.DataType = "varchar(50)";
                it.ColumnDescription = "修改人";
                it.IsNullable = true;
            }).UpdateProperty(it => it.ModificationTime, it =>
            {
                it.DataType = "datetime";
                it.ColumnDescription = "修改时间";
                it.IsNullable = true;
            }).UpdateProperty(it => it.IsDeleted, it =>
            {
                it.DataType = "bit";
                it.ColumnDescription = "是否删除 0 未删除 1已删除";
                it.DefaultValue = "0";
            });
    }

    public void EntityNameServiceMapping(EntityInfo entityInfo)
    {
        entityInfo.DbTableName = MappingConstant.TableNamePrefix + "wiki-details";
        entityInfo.TableDescription = "wiki 知识库的切分规则";
    }
}